﻿{include file="public/header"}
<title>订单列表</title>
</head>
<style>
    .layui-layer-page .layui-layer-content {
        overflow: visible !important;
    }

</style>
<body>
<nav class="breadcrumb">

    <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
       href="javascript:location.replace(location.href);" title="刷新"><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <form method="get">
        <div class="ch-c">
            <div class="ch-form-row">
                <p>创建时间:</p>
                <input type="text" name="start_time" id="countTimestart" onfocus="selecttime(1)"
                readonly
                value="<?php echo isset($data['start_time'])?$data['start_time']:''?>">
                <b>-</b>
                <input type="text" name="end_time" id="countTimeend" onfocus="selecttime(2)"
                readonly
                value="<?php echo isset($data['end_time'])?$data['end_time']:''?>">
            </div>
            <select name="status" class="ch-form-cSelect" >
                <option value="" >订单进度</option>
                <option value="20">待指派</option>
                <option value="1">待接单</option>
                <option value="2">待上门</option>
                <option value="3">待签约</option>
                <option value="4">待开工</option>
                <option value="5">待完工</option>
                <option value="7">已完工</option>
                <option value="6">已完成</option>
                <option value="8">已取消</option>
                <option value="9">退单</option>
                <option value="10">无效订单</option>
            </select>
            {if condition="$admin.qu ==0 "}
            <select name="channel_id" class="ch-form-cSelect">
                <option value="" selected>订单来源</option>
                {volist name='p' id='v'}
                <option value="{$v.id}">{$v.title}</option>
                {/volist}
            </select>
            {/if}
            {if condition="$admin.store_id ==0 "}
            <select name="store_id" class="ch-form-cSelect">
                <option value="" selected>分店</option>
                {volist name='l' id='v'}
                <option value="{$v.store_id}">{$v.store_name}</option>
               {/volist}
            </select>
            {/if}
            <select  class="ch-form-cSelect" name="full">
                <option value="" >介绍满意度</option>
                <option value="十分愿意">十分愿意</option>
                <option value="有可能" >有可能</option>
                <option value="不愿意" >不愿意</option>
            </select>
            <input type="text" name="remote_time" id="countTimeends" onfocus="selecttime(3)" size="17"
            class="date ch-form-assignor" readonly
            value="" placeholder="下次跟进时间">
            <select class="ch-form-cSelect" name="remote">
                <option value="" selected>跟进状态</option>
                {volist name='r' id='v'}
                <option value="{$v.title}">{$v.title}</option>
               {/volist}
            </select>
            <div class="ch-form-select">
                <select name="chen">
                    <option value="" >搜索名称</option>
                    <option value="contacts">姓名</option>
                    <option value="telephone">手机号</option>
                    <option value="order_no">订单编号</option>
                    <option value="addres">地址</option>
                </select>
                <input type="text" name="contacts" placeholder="">
            </div>
            <input type="text" name="assignor" placeholder="接单人" class="ch-form-assignor">
            <button class="btn btn-success" type="submit"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
        </div>
    </form>
    {if condition="$node.rule=='*'"}
    <a href="{:Url('index/Statistics/download')}" style="text-decoration:none" class="ml-5 dao"  title="导出"><span class="label label-primary">导出</span></a>
    {/if}

    <div class="mt-20">
        <div class="title-border">
            <div class="flex1 screen-phone">ID</div>
            <div class="flex5 screen-phone">订单号</div>
            <div class="flex2 screen-phone">来源</div>
            <div class="flex3">联系人</div>
            <div class="flex4">联系方式</div>
            <div class="flex8">地址</div>
            <div class="flex2 screen-phone">订单状态</div>
            <div class="flex3 screen-phone">下单时间</div>
            <div class="flex2 screen-phone">接单人</div>
            <div class="flex2 screen-phone">店铺</div>
            <?php if(!empty($remote_time)){?>
            <div class="flex2 screen-phone">状态</div>
            <?php } ?>
            <div class="flex6">操作</div>
        </div>
        {volist name='list' id='vo'}
        <div class="content-border">
            <div class="flex1 screen-phone">{$vo.order_id}</div>
            <div class="flex5 screen-phone">{$vo.order_no}</div>
            <div class="flex2 screen-phone">{$vo.title}</div>
            <div class="flex3">{$vo.contacts}</div>
            <div class="flex4">{$vo.telephone}</div>
            <div class="flex8">{$vo['province'].$vo['city'].$vo['county'].$vo['addres']}</div>
            <div class="flex2 screen-phone" style="color: red">{$vo.states}</div>
            <div class="flex3 screen-phone">{:date('Y-m-d H:i:s',$vo.created_time)}</div>
            <div class="flex2 screen-phone">{$vo.namekl}</div>
            <div class="flex2 screen-phone">{$vo.store_name}</div>
            <?php if(!empty($remote_time)){
            $ytime = strtotime(date("Y-m-d",strtotime($remote_time)));
            $yetime = $ytime+24 * 60 * 60-1;

            if($vo['th_time']<=$yetime &&  $vo['th_time']>=$ytime){
                if($vo['end_time']<=$yetime &&  $vo['end_time']>=$ytime){ ?>
            <div class="flex2 screen-phone">未</div>
                <?php }else{ ?>
            <div class="flex2 screen-phone" style="color: red">已</div>
            <?php  } }else{ ?>
            <div class="flex2 screen-phone">未</div>
            <?php  } } ?>
            <div class="flex6 screen-pc">
                <a class="ch-button ch-blue more" data-id="{$vo.order_id}" href="javascript:;" title="查看更多">查看更多</a>
            </div>
            <div class="flex6 screen-phone">
                {if condition="$admin.qu !=0 "}
                <a class="ch-button ch-blue info1" data-id="{$vo.order_id}" href="javascript:;" title="查看">查看</a>
                {else}
                <a class="ch-button ch-blue info" data-id="{$vo.order_id}" href="javascript:;" title="查看">查看</a>
                <a class="ch-button ch-gray edit" data-id="{$vo.order_id}"  href="javascript:;" title="编辑">编辑</a>
                {/if}
            </div>
            
        </div>
        {/volist}
        <div class="pages" style="float: right">{$list->render()}</div>

    </div>
    <div class="ch-more">
        <div class="ch-more-box">
            <div class="ch-more-top">
                <div class="ch-more-off"></div>
            </div>
            <div class="ch-more-tark">
                <div class="ch-more-content">
                    
                </div>
            </div>
        </div>
    </div>
</div>

{include file="public/footer"}


<script type="text/javascript">
    function selecttime(flag) {
        if (flag == 1) {
            var endTime = $("#countTimeend").val();
            if (endTime != "") {
                WdatePicker({dateFmt: 'yyyy-MM-dd', maxDate: endTime})
            } else {
                WdatePicker({dateFmt: 'yyyy-MM-dd'})
            }
        } else if(flag == 2){
            var startTime = $("#countTimestart").val();
            if (startTime != "") {
                WdatePicker({dateFmt: 'yyyy-MM-dd', minDate: startTime})
            } else {
                WdatePicker({dateFmt: 'yyyy-MM-dd'})
            }
        }else {
            WdatePicker({dateFmt: 'yyyy-MM-dd'})
        }
    }
    $('.page-container').on('click','.info',function () {
        var id = $(this).attr('data-id');
        var src = "{:Url('index/order/info')}";
        var index=layer.open({
            type: 2,
            area: ['100%', '100%'],
            fix: false,
            shade: 0.4,
            title: '订单详情',
            content: src + '?order_id=' + id
        });
        layer.full(index);
    });
    $('.page-container').on('click','.info1',function () {
        var id = $(this).attr('data-id');
        var src = "{:Url('index/Statistics/info')}";
        var index=layer.open({
            type: 2,
            area: ['100%', '100%'],
            fix: false,
            shade: 0.4,
            title: '订单详情',
            content: src + '?order_id=' + id
        });
        layer.full(index);
    });
    /**
     * 编辑
     */
    $('.page-container').on('click','.edit',function () {
        var winWidth = $(window).width();
        var areaWidth = "";
        var areaHeight = "";
        if( winWidth > 768 ){
            areaWidth = "800px"
            areaHeight = "600px"
        } else {
            areaWidth = '100%'
            areaHeight = '100%'
        }
        var id = $(this).attr('data-id');
        var src = "{:Url('index/order/edit')}";
        layer.open({
            type: 2,
            area: [areaWidth,areaHeight],
            scrollbar: false ,//屏蔽浏览器滚动条
            shade: 0.4,
            title: '订单编辑',
            zIndex: layer.zIndex,
            content: src + '?order_id=' + id,
            success: function(layero, index) {
                layer.iframeAuto(index);
            }
        });
    });
    /**
     * 导出
     */
    function downloadFile(){
        var dom=document.getElementById('ifile');
        dom.src= "{:Url('index/Statistics/download')}";
    }

</script>
<script type="text/javascript" src="{$Think.DOMAIN_SRC}/static/h-ui.admin/js/CH-ui.js"></script>



</body>
</html>